﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="Maksekorraldus", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(Maksekorraldus))]
    public class MaksekorraldusSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IMaksekorraldus clazz;
        
        public MaksekorraldusSerializer(IMaksekorraldus clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.Nr!=null) {
                Writer.WriteStartElement("Nr");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Nr))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MaksjaNimi!=null) {
                Writer.WriteStartElement("MaksjaNimi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MaksjaNimi))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Aeg!=null) {
                Writer.WriteStartElement("Aeg");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.Aeg))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseviisKL!=null) {
                Writer.WriteStartElement("MakseviisKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.MakseviisKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.PankKL!=null) {
                Writer.WriteStartElement("PankKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.PankKL))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Viitenumber!=null) {
                Writer.WriteStartElement("Viitenumber");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Viitenumber))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Selgitus!=null) {
                Writer.WriteStartElement("Selgitus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Selgitus))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Summa!=null) {
                Writer.WriteStartElement("Summa");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "decimal");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDecimal(((decimal)(clazz.Summa))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.ValuutaKL!=null) {
                Writer.WriteStartElement("ValuutaKL");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.ValuutaKL))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="Nr") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Nr = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Nr")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MaksjaNimi") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MaksjaNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("MaksjaNimi")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Aeg") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Aeg = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("Aeg")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="MakseviisKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.MakseviisKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("MakseviisKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="PankKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.PankKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("PankKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Viitenumber") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Viitenumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Viitenumber")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Selgitus") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Selgitus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Selgitus")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="Summa") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Summa = new global::Xtee.Core.Schema.XsdDecimal(Reader.ReadElementString("Summa")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="ValuutaKL") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.ValuutaKL = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("ValuutaKL")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
